package com.bawei.mvvmzonghe.datasource;

import com.bawei.mvvmzonghe.App;
import com.bawei.mvvmzonghe.dao.AppDataBase;
import com.bawei.mvvmzonghe.dao.GoodsDao;
import com.bawei.mvvmzonghe.entity.GoodsEntity;

import java.util.List;

import androidx.lifecycle.LiveData;

/**
 * @Author : yaotianxue
 * @Time : On 2023/9/15 11:15
 * @Description : RoomDataSource
 */
public class RoomDataSource {
    private GoodsDao mGoodsDao;

    public RoomDataSource() {
        mGoodsDao = AppDataBase.getInstance().getGoodsDao();
    }
    //存储数据
    public void insert(List<GoodsEntity.ListBean> list){
        mGoodsDao.insert(list);
    }
    //数据库查询数据
    public LiveData<List<GoodsEntity.ListBean>> getRoomGoods(){
        return mGoodsDao.getGoods();
    }
}
